//
//  DAUMonControlTCell.m
//  DAU-iOS
//
//  Created by XiangDongMBP on 2016/11/18.
//  Copyright © 2016年 East. All rights reserved.
//

#import "DAUMonControlTCell.h"

@implementation DAUMonControlTCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    [self.rightSwitch addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)configViewWithData:(DAUColContactItem *)item {
    self.nameLabel.text = item.name;
    [self.rightSwitch setOn:(item.value == 1) animated:NO];
}

- (void)switchValueChanged:(UISwitch *)aSwitch {
    if ([self.delegate respondsToSelector:@selector(dAUMonControlTCell:switchChanged:)]) {
        [self.delegate dAUMonControlTCell:self switchChanged:aSwitch];
    }
}

@end
